package com.ideajava.test;

import java.util.List;

import com.geccocrawler.gecco.annotation.PipelineName;
import com.geccocrawler.gecco.pipeline.Pipeline;
import com.geccocrawler.gecco.request.HttpRequest;
import com.geccocrawler.gecco.scheduler.SchedulerContext;
import com.geccocrawler.gecco.spider.HrefBean;

/**
 * @Description :
 * @FileName: GetArticlePipeline.java
 * @Author :WeiHui.Zhang
 * @Data : 2016年3月25日 下午3:45:34
 * @Version:V1.00
*/
@PipelineName("getArticlePipeline")
public class GetArticlePipeline implements Pipeline<AllPage> {

	@Override
	public void process(AllPage page) {
		List<Page> pages = page.getPages();
		for (Page page2 : pages) {
			List<HrefBean> title = page2.getTitle();
			for (HrefBean hrefBean : title) {
				String url = "http://www.ideajava.org" + hrefBean.getUrl();
				
				//System.out.println("请求：" + url);
				
				HttpRequest currRequest = page.getRequest();
				SchedulerContext.into(currRequest.subRequest(url));
			}
		}
	}

}
